﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Aribaccio.Datum
{
    /// <summary>
    /// 数据库连接配置
    /// </summary>
    [Serializable]
    public class CoreConnectionOption
    {
        /// <summary>
        /// 数据库连接模式
        /// </summary>
        public string ConnectionMode { get; set; }
        /// <summary>
        /// 数据库连接字符
        /// </summary>
        public string? ConnectionString { get; set; }
        /// <summary>
        /// 数据库连接类型
        /// </summary>
        public DBConnectType ConnectType => ConnectionMode.ToEnum<DBConnectType>();
        /// <summary>
        /// 数据库连接字符串状态
        /// </summary>
        public ExecuteStatus ConnectionStringStatus => !string.IsNullOrWhiteSpace(ConnectionString) ? ExecuteStatus.Yes : ExecuteStatus.No;

        /// <summary>
        /// 构造函数
        /// </summary>
        public CoreConnectionOption()
        {
            this.ConnectionMode = DBConnectType.SQLServer.ToStringName();
        }
    }
}
